Skip to content

Conversation

@Henrrypg
Copy link
Contributor

@Henrrypg Henrrypg commented Nov 12, 2025

This pull request introduces a new AI-powered educator assistant workflow for generating quiz questions in Open edX, integrating a custom processor and orchestrator, and improving configuration and utility support for content libraries. The most important changes are grouped below:

Educator Assistant Workflow Integration

  • Added EducatorAssistantProcessor class, which uses LiteLLM to generate quiz questions based on course unit content, formats questions in OLX, and adds them to content libraries. Includes robust prompt handling, error management, and JSON output enforcement. (backend/openedx_ai_extensions/processors/educator_assistant_processor.py)
  • Introduced EducatorAssistantOrchestrator to orchestrate the workflow: it extracts unit content, invokes the educator assistant processor, and returns a link to the generated questions in the content library. (backend/openedx_ai_extensions/workflows/orchestrators.py)
  • Registered EducatorAssistantProcessor in the processors module for proper import and usage. (backend/openedx_ai_extensions/processors/__init__.py)

Content Library Utilities

  • Added ContentLibraryHelper class to encapsulate operations for creating collections, blocks, and updating items in content libraries, supporting the educator assistant’s output integration. (backend/openedx_ai_extensions/processors/content_libraries_utils.py)

Configuration and Prompt Enhancements

  • Added a comprehensive prompt template for quiz question generation, specifying roles, behaviors, OLX formatting, and output requirements. (backend/openedx_ai_extensions/prompts/default_generate_quiz_questions.txt)
  • Created a workflow configuration (default_cms.json) for the educator assistant, defining processor, actuator, and UI component settings for CMS usage. (backend/openedx_ai_extensions/workflows/configs/default_cms.json)
  • Updated configuration loader to select default_cms.json when running in CMS context, enabling context-specific workflows. (backend/openedx_ai_extensions/workflows/configs/mock_functions.py)

Testing and Miscellaneous

  • Improved test setup to use a valid BlockUsageLocator for unit IDs, ensuring realistic context in API workflow tests. (backend/tests/test_api.py) [1] [2]
  • Minor config and UI adjustments, such as changing actuator message keys and simplifying processor config merging logic. (backend/openedx_ai_extensions/workflows/configs/openai_hello.json) [1] (backend/openedx_ai_extensions/settings/production.py) [2]

These changes collectively enable course authors to use an integrated AI assistant to automatically generate and add assessment questions to their content libraries, improving authoring efficiency and instructional quality.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 12, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Nov 12, 2025

Thanks for the pull request, @Henrrypg!

This repository is currently maintained by @felipemontoya.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.78%. Comparing base (d0c9aef) to head (c54cf4f).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
+ Coverage   75.00%   75.78%   +0.78%     
==========================================
  Files          22       28       +6     
  Lines        1024     1425     +401     
  Branches       68       82      +14     
==========================================
+ Hits          768     1080     +312     
- Misses        244      330      +86     
- Partials       12       15       +3     
Flag Coverage Δ
unittests 75.78% <ø> (+0.78%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Henrrypg Henrrypg changed the title feat: add library problem feat: POC add library problem Nov 12, 2025
@Henrrypg Henrrypg force-pushed the hpg/poc-adding-library-problems branch from 5b86d69 to 591df56 Compare November 12, 2025 15:36
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Nov 13, 2025
@Henrrypg Henrrypg force-pushed the hpg/poc-adding-library-problems branch 2 times, most recently from 0d5d1cd to 53a9c9e Compare November 19, 2025 15:36
@Henrrypg Henrrypg marked this pull request as ready for review November 19, 2025 15:37
@felipemontoya felipemontoya force-pushed the hpg/poc-adding-library-problems branch from a7d0c85 to 38b7919 Compare November 24, 2025 17:24
@felipemontoya felipemontoya requested review from Copilot and felipemontoya and removed request for Copilot November 24, 2025 23:58
Copilot finished reviewing on behalf of felipemontoya November 25, 2025 00:02
@felipemontoya
Copy link
Member

felipemontoya commented Nov 25, 2025

@Henrrypg I gave this POC some time today and I fixed some of the most oustanding issues.

  • the backend used is now at the CMS
  • the default config profile for cms is now EducatorAssistantOrchestrator
  • there is a new component to render the AI assist for studio.
image

I also did some minor refactors on the callAIService function to make it more general.

From my perspective, this PR still needs:

  • fix the question generation so that it produces the questions and groups them in a collection
  • A response component that says the name of the collection and puts a link to it.
  • fixing the names of the generated questions
  • make sure we pass QA for front and backend
  • make the EducatorAssistantProcessor safe to use with gpt-5.1 (mini o full)
  • some refactor of the generate_quiz_questions encapusating the llm call and the library functions
  • probably a semantic review of the instructions

@Henrrypg Henrrypg force-pushed the hpg/poc-adding-library-problems branch from 1bbcd14 to b62ac25 Compare November 26, 2025 19:58
@Henrrypg
Copy link
Contributor Author

Henrrypg commented Nov 26, 2025

@felipemontoya I can't check the previous points, but all of them should be addressed.

I keep some extra points:

  • Is it possible to escape codecov for this one? the chat feature will make several changes to models and introduces several tests as well, add tests here implies modify all of them in the near future
  • Maybe could be good to add a new settings like AI_EXTESIONS_PROMPT_PATHS to allow flexibility to choose prompts

@felipemontoya
Copy link
Member

Maybe could be good to add a new settings like AI_EXTESIONS_PROMPT_PATHS to allow flexibility to choose prompts

I would not care too much about this, since we are going to solve it once we make prompts be overridable via model.

Is it possible to escape codecov for this one? the chat feature will make several changes to models and introduces several tests as well, add tests here implies modify all of them in the near future

We can focus on merging the chat feature first and then we'll rebase this on top

@Henrrypg Henrrypg force-pushed the hpg/poc-adding-library-problems branch from a9c1a5f to 323a880 Compare November 27, 2025 21:17
@Henrrypg Henrrypg force-pushed the hpg/poc-adding-library-problems branch 2 times, most recently from cc22a09 to 601bb77 Compare November 27, 2025 22:08
@felipemontoya
Copy link
Member

This is getting so close. In our last call we saw 3 things missing

  • a small review of the response UI
  • add AIworkflow session so that reloading the page does not remove the link
  • rename content libraries utils | relocate into openedx dir

@Henrrypg Henrrypg force-pushed the hpg/poc-adding-library-problems branch from 4cf0d10 to 5eb25df Compare November 27, 2025 22:36
@Henrrypg Henrrypg force-pushed the hpg/poc-adding-library-problems branch from a023447 to cfc3e21 Compare November 28, 2025 17:07
Copy link
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed some openedx imports that we would need to make dynamic in the same pattern we have used for other plugins in the past. E.g https://github.com/eduNEXT/eox-tenant/blob/master/eox_tenant/edxapp_wrapper/edxmako_module.py

def create_block(self, data):
"""Create a library block."""
# pylint: disable=import-error, import-outside-toplevel
from openedx.core.djangoapps.content_libraries import api
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this, but I think we need to solve before merge. For this the best would be to use the backend pattern we use in many other plugins

def modify_block_olx(self, usage_key, data):
"""Modify the OLX of a library block."""
# pylint: disable=import-error, import-outside-toplevel
from openedx.core.djangoapps.content_libraries import api
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem


self.update_submission(messages)

def update_submission(self, data):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we should be storing the current data in a submission, but instead in the session. The submission would be for what we sent do the llm and what comes back

Copy link
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this has reached a good for v1 status. I think we can merge and deploy to see it in action at the sandbox

@felipemontoya felipemontoya force-pushed the hpg/poc-adding-library-problems branch 4 times, most recently from bde069e to 5ed8fe9 Compare November 28, 2025 22:55
@felipemontoya felipemontoya force-pushed the hpg/poc-adding-library-problems branch from 5ed8fe9 to c54cf4f Compare November 28, 2025 22:55
@felipemontoya felipemontoya merged commit 43aab4b into openedx:main Nov 28, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants